import Vue from 'vue'
import Router from 'vue-router'
//使用懒加载的方式来引入,只有路由被访问的时候才加载
import home from '@/components/home'
const loginpage = resolve => require(['@/components/Login'],resolve)

Vue.use(Router)

import Layout from '../views/layout/layout'
import AppMain from '../views/layout/components/AppMain'

export const routes = [
    {
      path: '/',
      name: 'login',
      hidden: true,
      component: loginpage
    },
    {
      path: '/login',
      name: 'login',
      hidden: true,
      component: loginpage
    },
    //主页
    {
      path: '/user',
      component: Layout,
      name: 'user',
      meta: {title: '主页',icon: 'el-icon-user-solid'},
      children: [
        {
          path: 'home',
          name: 'home',
          component: home,
          meta: { title: '用户列表', auth: true }
        },
        {
          path: 'import',
          name: 'import',
          component: () => import("@/views/importUser.vue"),
          meta: { title: '导入', auth: true }
        }
    ]
    },
    //个人信息
    {
      path: '/test',
      component: Layout,
      name: 'test',
      meta: {title: '个人信息',icon: 'el-icon-message-solid'},
      children: [
        {
          path: 'userinfo',
          name: 'userinfo',
          component: () => import('@/views/user/userInfo.vue'),
          meta: { title: '我的信息', auth: true }
        },
        {
          path: 'change',
          name: 'change',
          hidden:true,
          component: () => import('@/views/user/changeInfo.vue'),
          meta: { title: '修改信息', auth: true }
        }
    ]
    },
    //学习
    {
      path:'/study',
      component: Layout,
      name: 'study',
      meta:{title: '学习',icon: 'el-icon-s-platform'},
      children:[
        {
          path: 'one',
          name: 'one',
          meta: {title: '学习中'}
        },
        {
          path: 'two',
          name: 'two',
          meta: {title: '学习至上'}
        },
        {
          path: 'three',
          name: 'three',
          meta: {title: '学习快乐'},
          component: AppMain,
          children: [{
            path: 'abc',
            name: 'abc',
            component: () => import("@/views/importUser.vue"),
            meta: {title: '学习快乐1111'}
          },
          {
            path: 'abd',
            name: 'abd',
            hidden: true,
            component: () => import("@/views/importUser.vue"),
            meta: {title: '学习快乐1111'}
          }
        ]
        },
        {
          path: 'four',
          name: 'four',
          meta: {title: '学习结束'}
        }
      ]
    }
]
  

